package com.qr.backend.config;

import com.qr.backend.interceptor.AuthorizeInterceptor;
import jakarta.annotation.Resource;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author : jinxiaobo
 * @date : 2023年12月21日 22:32:11
 * @description :
 */
@Configuration
public class WebConfiguration implements WebMvcConfigurer {

    @Resource
    private AuthorizeInterceptor interceptor;

    //注册拦截器,拦截所有请求,这个拦截器是添加到了
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(interceptor)
                .addPathPatterns("/**")
                .excludePathPatterns("/api/auth/**");
    }

}
